//<script type='text/javascript'>

/**
 * 	tweet from the engine
 */
 
var Twitter = function ( vars ) {
	
	// build csv upload grid
	Object.extend(obj = new Element( "div", {id:"twitter", class:"ext twitter" }), dashboard.ext.twitter);
	obj.insert( obj.grid = new Unit( "Tweet." ));
		
	return obj.init();
}


dashboard.ext.twitter	= {
	
	init		: function() {
		
		/*this.grid.insertli( this.dropper = new Dropper({ title: "Drop your CSV here", descr: "one at a time, please", type: "media.csv", file_ext: "csv", succes: this.onsucces.bind( this ) }));
			
		options = { onSuccess: this.define.bind( this ), parameters: { set: Object.toJSON({ transfer_type: "js", trg: "csv", type: "csv", action: "seed" }) }};
		new Ajax.Request( 'control.call.php', options );
	*/
		return this;
	},
	
	define		: function( resp ) {
		
		/*if( resp.responseJSON );
			this.listtypes = resp.responseJSON;*/
	},
	
	selected	: 0,
	
	// button to trigger the dashboard
	addbutton	: function() {
		obj = new Element("div", { id:"dashboard.ext.twitterbutton", class:"ext_button twitter", name:"ext:twitter" }).observe('click', dashboard.showhide );
		obj.ext = Twitter;
		return obj;
	},

	onsucces	: function( xhr ) {
		
		/*if( xhr.responseText ) {
		
			this.dropper.addClassName( "done" );
			uploaded = xhr.responseText.evalJSON();
			target = this;
			
			
			this.listtypes.each( function( list ){ uploaded.each( function( upl ){
				target.grid.insertli( new Button({ transfer_type: "js", action: 'process', type: 'csv', descr: list.title, class: 'wide', id: upl.id, objtype: upl.type, listtype: list.type }, target.listen.bind( target ), target.listenProgress.bind( target ), target.showResults.bind( target ))) //
			})})
		
		} else this.onfail();*/
		
	},
	
	onfail			: function() {
		
		//this.update( "Something went wrong. Please reload." );
	},
	
	listen			: function( e ) {
		
		//this.grid.insertli( "process started, please wait." );

	},
	
	listenProgress	: function( e ) {
		
		//this.grid.insertli( "still processing..." );
	},
	
	showResults		: function( xhr ) {
		
		/*this.insert( this.result = new Unit( "Results" ));
		
		
		xhr.responseJSON.each( function( l ){ this.insertli( l ); }.bind( this.result ));
		this.result.enableScroll( 340 );*/
	}
	}